package com.tensquare.friend;

import com.tensquare.friend.pojo.Friend;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by Administrator on 2021/6/22.
 */
public interface FriendDao extends JpaRepository<Friend,String> {

    //通过query注解指定执行语句  注意查询的表名皆为对应的实体
    public Friend findByUseridAndFriendid(String userid,String friendid);

    //通过query注解指定执行语句  注意查询的表名皆为对应的实体
    @Modifying
    @Query(value="update Friend set islike=?1 where userid=?2 and friendid=?3")
    public void updateIslike(String islike,String userid,String friendid);

    @Modifying
    @Query(value="delete from Friend where userid=?1 and friendid=?2")
    void deleteFriend(String userId, String friendid);
}
